import React, {FC} from "react";
import {Breadcrumb} from "antd";
import {Link, useLocation} from "react-router-dom";

const BreadcrumbPath: FC<any> = () => {
    const {pathname} = useLocation()
    const pathNmae: any = {
        main: '主页',
        home: '首页',
        mine: '个人中心',
        academicAffairs: '教务管理',
        subject: '学科管理',
        class: '班级管理',
        projectType: '项目类型',
        user: '用户管理',
        userList: '用户列表',
        addUser: '添加用户',
        userData: '用户分析',
        project: '项目管理',
        myProject: '我的项目',
        upProject: '提交项目',
        projectScore: '项目评分',
        projectData: '项目数据',
        announcement: '公告管理',
        announcementList: '公告列表',
        addAnnouncement: '添加公告',
        interview: '论面试',
        addInterview: '发布言论',
        interviewList: '言论广场',
        myInterview: '我的言论',
    }
    let pathStr = ""
    return (
        <Breadcrumb style={{margin: "10px 0"}}>
            {
                pathname.split('/').slice(1).map((item, index) => {
                    pathStr += `/${item}`
                    return (
                        <Breadcrumb.Item key={index}>
                            <Link to={pathStr}>
                                {pathNmae[item]}
                            </Link>
                        </Breadcrumb.Item>
                    )
                })
            }
        </Breadcrumb>
    )
}
export default BreadcrumbPath;